<?php
session_start();
require_once('style.css');
include('printstyle.php');
$taal = $_SESSION['taal'];
require_once('pasmy/dbwaarden.php');
include('french.php');
if(empty($_SESSION['taal'])) {
	session_destroy();
		Header( "HTTP/1.1 301 Moved Permanently" );
		 
		Header( "Location: login.php" ); 
}
echo '<body bgcolor="#FFB870">';
$mysql_id = mysql_connect($dbhost, $dbuser, $dbpass);
mysql_select_db($db, $mysql_id);
$idnr = $_GET['idnr'];
$sql = "Select * from clienten where `id` = '$idnr'";
$res = mysql_query($sql, $mysql_id);
$fout = mysql_errno($mysql_id);
	if ($fout != 0) {
		echo "<font size='+2' color='#FF0000'>" . mysql_errno($mysql_id) . ": " . mysql_error($mysql_id) . "\n" . "</font>";
		mysql_close($mysql_id);
		echo '</body></html>';
		exit;
		}
while ($row = mysql_fetch_row($res)) 
{
			$client = $row[0];
			$straatnaam = $row[2];
			$huisnr = $row[3];
			$zipnr = $row[4];
			$stad = $row[5];
			$telefoon = $row[6];
			$faxx = $row[7];
			$emails = $row[8];
			$tvas = $row[9];
			$banks = $row[10];
			$rekennnr = $row[11];
			$dossiernummer = $row[12];
			
}

if(isset($_POST['updaten']))
{
	$idclient = addslashes($_POST["idnr"]);
	$client = addslashes($_POST["client"]);
	$plaat = addslashes($_POST["plaats"]);
	$straat = addslashes($_POST["straat"]);
	$nr = addslashes($_POST["nr"]);
	$zip = addslashes($_POST["zip"]);
	$tel = addslashes($_POST["tel"]);
	$fax = addslashes($_POST["fax"]);
	$email = addslashes($_POST["email"]);
	$btw = addslashes($_POST["btw"]);
	$banknaam = addslashes($_POST["banknaam"]);
	$reknr = addslashes($_POST["reknr"]);
	$dossier = addslashes($_POST["dossiernr"]);
	$sql = "update clienten set client='$client', straat='$straat', nr='$nr', zip='$zip', stad='$plaat', tel='$tel', fax='$fax', email='$email',tva='$btw',bank='$banknaam',reknr='$reknr',clientnr='$dossier' where id=$idclient";
	echo "SQL = $sql<br>";
	//echo "sql = $sql<br>";
	/* hier wordt alles weggeschreven */
	$res = mysql_query($sql, $mysql_id);
	$fout = mysql_errno($mysql_id);
	if ($fout != 0) {
		echo "<font size='+2' color='#FF0000'>" . mysql_errno($mysql_id) . ": " . mysql_error($mysql_id) . "\n" . "</font>";
		mysql_close($mysql_id);
		echo '</body></html>';
		exit;
		}
	Header( "HTTP/1.1 301 Moved Permanently" );
		 
	Header( "Location: zoeken4.php" ); 
exit();
}
?>
<h2><div style="text-align: center">Mettre &agrave; jour le Client</div></h2><br /><br />
<table align="center" width="25%">
<form action="updateClients.php" method="post">
<tr>
<td><strong><?php echo $klant[$taal];?></strong></td><td><input type="text" name="client" size="25" maxlength="25" value="<?php echo $client; ?>"></td>
</tr>
<tr>
<td><strong><?php echo $plaats[$taal];?></strong></td><td><input type="text" name="plaats" size="25" maxlength="25" value="<?php echo $stad; ?>" /></td>
</tr>
<tr>
<td><strong><?php echo $straat[$taal];?></strong></td><td><input type="text" name="straat" size="25" maxlength="25" value="<?php echo $straatnaam; ?>"/></td>
</tr>
<tr>
<td><strong><?php echo $nr[$taal];?></strong></td><td><input type="text" name="nr" size="25" maxlength="25" value="<?php echo $huisnr; ?>"/></td>
</tr>
<tr>
<td><strong><?php echo $zip[$taal];?></strong></td><td><input type="text" name="zip" size="25" maxlength="25" value="<?php echo $zipnr; ?>"/></td>
</tr>
<tr>
<td><strong>Tel</strong></td><td><input type="text" name="tel" size="25" maxlength="25" value="<?php echo $telefoon; ?>"/></td>
</tr>
<tr>
<td><strong>Fax</strong></td><td><input type="text" name="fax" size="25" maxlength="25" value="<?php echo $faxx; ?>"/></td>
</tr>
<tr>
<td><strong>E-mail</strong></td><td><input type="text" name="email" size="25" maxlength="25" value="<?php echo $emails; ?>"/></td>
</tr>
<tr>
<td><strong>TVA / BTW</strong></td><td><input type="text" name="btw" size="25" maxlength="25" value="<?php echo $tvas; ?>"/></td>
</tr>
<tr>
<td><strong><?php echo $banknaam[$taal];?></strong></td><td><input type="text" name="banknaam" size="25" maxlength="25" value="<?php echo $banks; ?>"/></td>
</tr>
<tr>
<td><strong><?php echo $reknr[$taal];?></strong></td><td><input type="text" name="reknr" size="25" maxlength="25" value="<?php echo $rekennr; ?>"/></td>
</tr>
<tr>
<td><strong><?php echo $clientnr[$taal];?></strong></td><td><input type="text" name="dossiernr" size="25" maxlength="25" value="<?php echo $dossiernummer; ?>"/>
<input type="hidden" name="idnr" value="<?php echo $idnr; ?>" />
</td>
</tr>




<tr><td colspan="2">&nbsp;</td></tr>
<tr><td colspan="2"><div style="text-align: center"><input type="submit" name="updaten" value="Mettre &agrave; Jour" /></div></td></tr>
</form>
</body>